// var
@screenshot-prefix-cls      : x-screenshot;
@screenshot-font-weight     : normal;
@screenshot-font-size-small : 12px;
@screenshot-font-size       : 14px;
@screenshot-font-size-large : 16px;

// mixins
.screenshot-size(@font-size) {
  &.@{screenshot-prefix-cls} {
    font-size: @font-size;
  }
}
.screenshot-color(@color) {
  .@{screenshot-prefix-cls}__range {
    border-color: tint(@color, 20%);
    &_operate {
      background-color: tint(@color, 20%);
    }
  }
  .@{screenshot-prefix-cls}__toolsbar {
    color: @color;
    border-color: tint(@color, 50%);
    &_item {
      background-color: tint(@color, 90%);
      &:hover, &.active {
        background-color: tint(@color, 70%);
      }
    }
  }
}
@keyframes spinner {
  0% {transform: rotate(0deg);}
  100% {transform: rotate(360deg);}
}

// styles
.@{screenshot-prefix-cls} {
  display: inline-block;
  font-weight: @screenshot-font-weight;
  user-select: none;
  &__control {
    display: inline-block;
    min-width: 1em;
    min-height: 1em;
  }
  &__canvas {
    .fixed-fullscreen;
  }
  &__range {
    position: fixed;
    border-width: 1px;
    border-style: dashed;
    &_canvas {
      .absolute-fullscreen;
      overflow: hidden;
    }
    &_operate {
      width: 7px;
      height: 7px;
      position: absolute;
      &&_lt { left: 0; top: 0; transform: translate(-50%, -50%); cursor: se-resize; }
      &&_lm { left: 0; top: 50%; transform: translate(-50%, -50%); cursor: ew-resize; }
      &&_lb { left: 0; bottom: 0; transform: translate(-50%, 50%); cursor: sw-resize; }
      &&_mt { left: 50%; top: 0; transform: translate(-50%, -50%); cursor: ns-resize; }
      &&_mb { left: 50%; bottom: 0; transform: translate(-50%, 50%); cursor: ns-resize; }
      &&_rt { right: 0; top: 0; transform: translate(50%, -50%); cursor: sw-resize; }
      &&_rm { right: 0; top: 50%; transform: translate(50%, -50%); cursor: ew-resize; }
      &&_rb { right: 0; bottom: 0; transform: translate(50%, 50%); cursor: se-resize; }
    }
  }
  &__toolsbar {
    position: fixed;
    display: flex;
    padding: 2px;
    border-width: 1px;
    border-style: solid;
    background-color: #fff;
    &_item {
      float: left;
      width: 2.4em;
      height: 2.4em;
      border: 2px solid transparent;
      background-clip: padding-box;
      .flex-center;
      cursor: pointer;
      .x-drawboard,
      .x-drawboard__control {
        width: 100%;
        height: 100%;
      }
      .x-drawboard__control {
        .flex-center;
      }
    }
  }
  &__loading {
    .fixed-fullscreen;
    background-color: rgba(0, 0, 0, 0.3);
    color: #fff;
    text-shadow: 0 0 5px #000;
    .flex-center;
    .xvu-spinner {
      opacity: .5;
      animation: spinner 4s linear infinite;
    }
    p {
      line-height: 2;
      text-align: center;
    }
  }
  .screenshot-size(@screenshot-font-size);
  .screenshot-color(@default-color);
}

// styles - more
.@{screenshot-prefix-cls} {
  &-small {
    .screenshot-size(@screenshot-font-size-small);
  }
  &-large {
    .screenshot-size(@screenshot-font-size-large);
  }
  &-brown {
    .screenshot-color(@brown-color);
  }
  &-primary {
    .screenshot-color(@primary-color);
  }
  &-success {
    .screenshot-color(@success-color);
  }
  &-warning {
    .screenshot-color(@warning-color);
  }
  &-danger {
    .screenshot-color(@danger-color);
  }
  &-info {
    .screenshot-color(@info-color);
  }
  &-saving {
    .@{screenshot-prefix-cls}__range {
      border-color: transparent;
      &_operate {
        background-color: transparent;
      }
    }
  }
}
